package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.domain.SystemConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISystemConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * SystemConfig参数配置
 *
 * @author lixin
 */
@RestController
@RequestMapping("/system/hyconfig")
public class HySystemConfigController extends BaseController {

	@Autowired
	private ISystemConfigService systemConfigService;

	/**
	 * 获取SystemConfig参数配置
	 */
	@PreAuthorize("@ss.hasPermi('system:config:get')")
	@GetMapping(value = "/getSystemConfig")
	public AjaxResult getSystemConfig() {
		return AjaxResult.success(systemConfigService.getConfig());
	}

	/**
	 * 修改SystemConfig参数配置
	 */
	@PreAuthorize("@ss.hasPermi('system:config:edit')")
	@Log(title = "SystemConfig参数管理", businessType = BusinessType.UPDATE)
	@PutMapping(value = "/editSystemConfig")
	public AjaxResult edit(@Validated @RequestBody SystemConfig config) {
		return toAjax(systemConfigService.editSystemConfig(config));
	}


}
